<include file="./Tpl/Home/top.html"/>
<include file="./Tpl/Home/header.html" />
<!--交易页面的子导航区-->
<include file="./Tpl/Home/user_nav.html" />

<div class="container">
<!--全站交易记录-->
<div class="trade-part trade-part-hd mt20">
  <div class="trade-hd">
        <h5><i class="icon_condition"></i>存款分红</h5>
  </div>
  <div class="md">
    <div class="my-grid" id="order-grid" style="margin-bottom:20px;">
	    <form action="{$path}/User/bank" method="post" id="formid">
			<table class="items table table-striped table-bordered table-condensed chkreal">
			<tbody>
			<tr>
				<td>币种：</td>
				<td>
				    <select name="typeid">
					    <volist name="types" id="vo">
					    <option value="{$vo.id}" <eq name="vo.tid" value="$vo.id">selected</eq>>{$vo.nickname}</option>
						</volist>
					</select>
					当前余额：<input type="text" name="coin" readonly style="width:150px;"/>
				</td>
			</tr>
			<tr><td>存款金额：</td><td><input type="text" name="coin" placeholder="请输入存款金额"/></td></tr>
			<tr><td>交易密码：</td><td><input type="text" name="transpw" placeholder="请输入交易密码"/></td></tr>
			<tr><td>验证码：</td><td><input type="text" name="code" placeholder="请输入验证码" style="width:130px;"/><img id="refresh" style="height:30px" class="code_img" onclick="document.getElementById('refresh').src='{$path}/Login/checkcode/t/'+Math.random()" src="{$path}/Login/checkcode/" title="看不清？点一下"/></td></tr>
			<tr><td colspan=2><input type="button" id="subbtn" class="btn" value="确定" style="width:110px;"/></td></tr>
			</tbody>
			</table>
		</form>
	</div>
	<div class="my-grid" id="order-grid">
		<table class="items table table-striped table-bordered table-condensed saferoom">
		<thead>
		<tr><th>币种</th><th>金额</th><th>分红</th><th>存款时间</th></tr>
		</thead>
		<tbody>
		<volist name="list" id="vo" empty="$empty">
		<tr><td class="chkTit">{$vo.nickname|default='无'}</td><td>{$vo.coin|default='0'}</td><td>{$vo.div|default='0'}</td><td>{$vo.addtime|default='无'}</td></tr>
		</volist>
		</tbody>
		</table>
	</div>
  </div>
</div>
</div>
<!--尾部-->
<include file="./Tpl/Home/footer.html" />
<!-- footer -->

<div class="modal hide fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>

<!--[if IE 6]><script src="/js/ie-6.js"></script><![endif]-->
<script type="text/javascript" src="/Public/Home/js/jquery.SuperSlide.js"></script>
<script type="text/javascript" src="/Public/Home/js/slideTxtBox.js"></script>
<script type="text/javascript" src="/Public/Home/js/bootbox.js"></script>
<script type="text/javascript" src="/Public/Home/js/box.js"></script>
<script type="text/javascript" src="/Public/Home/js/lang.js"></script>
<script type="text/javascript" src="/Public/Home/js/responseHandler.js"></script>
<script type="text/javascript" src="/Public/Home/js/jquery.yiigridview.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
jQuery('body').popover({'selector':'a[rel=popover]'});
jQuery('#order-grid').yiiGridView({'ajaxUpdate':['order-grid'],'ajaxVar':'ajax','pagerClass':'pagination','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'items table table-striped table-bordered table-condensed','selectableRows':1,'enableHistory':false,'updateSelector':'{page}, {sort}','filterSelector':'{filter}','pageVar':'CurrencyTransaction_page'});
});
/*]]>*/



$(document).ready(function(){
	$('#subbtn').click(function(){
		var goldnum = $('input[name=coin]').val();
	
	    if(goldnum=="" || goldnum <= 0){
		    msgDalog("请输入存款金额！","",0);
		}else if(isNaN(goldnum)){
			msgDalog('存款金额应该是数字！');
			$('input[name=coin]').val('');
			return false;
		}else if($('input[name=code]').val()==""){
		    msgDalog("请输入验证码！","",0);
		}else{
			var pos = goldnum.indexOf('.');
                if(pos != -1){
                    if(goldnum.substring(0,pos)=='') {
                        msgDalog('存款金额不合法！');
                        return false;
                    }
                    len = goldnum.substring(pos+1,goldnum.length);
                    if(len.length > 8) {
                        msgDalog('存款金额小数位数不能超过8位！');
                        return false;
                    }
                    $('#formid').submit();
                }else{
                    $('#formid').submit();
                }
		}
	});

	$('input[name=coin]').keyup(function(){
		
	    var goldnum = $('input[name=coin]').val();

		if(isNaN(goldnum)){
			msgDalog('存款金额应该是数字！');
			$('input[name=goldnum]').val('');
			return false;
		}
		
        var pos = goldnum.indexOf('.');
		if(pos != -1){
			
			if(goldnum.substring(0,pos)=='') {
				msgDalog('存款金额不合法！');
				$('input[name=coin]').focus();
				return false;
			}
			len = goldnum.substring(pos+1,goldnum.length);
			if(len.length > 8) {
				v = goldnum.substring(0,pos) + '.' + goldnum.substring(pos+1,pos+9);
				$('input[name=coin]').val(v);
			}
		}
	});

	$('input[name=coin]').change(function(){
		
	    var goldnum = $('input[name=coin]').val();

		if(isNaN(goldnum)){
			msgDalog('存款金额应该是数字！');
			$('input[name=coin]').val('');
			return false;
		}
		
        var pos = goldnum.indexOf('.');
		if(pos != -1){
			
			if(goldnum.substring(0,pos)=='') {
				msgDalog('存款金额不合法！');
				return false;
			}
			len = goldnum.substring(pos+1,goldnum.length);
			if(len.length > 8) {
				v = goldnum.substring(0,pos) + '.' + goldnum.substring(pos+1,pos+9);
				$('input[name=coin]').val(v);
     		}
		}
	});
});


$(document).ready(function(){
    $('#sendbtn').click(function(){
		var moble = "{$user_info.moble}";
	    $.post('/?s=Home/Call/run',{phone:moble},function(flag){
		    if(flag==1){
			    alert('语音已开启，请注意查收验证码！');
			}else{
			    alert('验证失败！请重新验证。');   
			}
		});
	});

	var czcoin = new Array();
	<volist name="types" id="vo">
		czcoin[{$vo.id}] = "{$vo.coin}";
	</volist>
    $('select[name=typeid]').change(function(){
		$('input[name=coin]').val(czcoin[$(this).val()]);
	});

	var typeid = $('select[name=typeid]').val();
	$('input[name=coin]').val(czcoin[typeid]);
});
</script>


</body></html>